package com.twohand.admin.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.twohand.admin.Entity.Qrcode;
import com.twohand.admin.Entity.Shop;
import com.twohand.admin.Vo.Order.OrderStatisVo;
import com.twohand.admin.Vo.SelectOptions;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ShopMapper extends BaseMapper<Shop> {
    @Select("SELECT \n" +
            "    CONCAT(shop_name, '-', \n" +
            "        CASE \n" +
            "            WHEN platform = 1 THEN '美团外卖'\n" +
            "            WHEN platform = 2 THEN '饿了么'\n" +
            "            WHEN platform = 3 THEN '京东秒送'\n" +
            "            ELSE '未知平台'\n" +
            "        END\n" +
            "    ) AS label, \n" +
            "    id AS value \n" +
            "FROM shop")
    List<SelectOptions> getOptions();
    @Select("select shop_name as label,shop_name as value from shop")
    List<SelectOptions> getShopNameOption();
    List<Shop> getList(String shopName,Integer sid,String activeDate,Integer platform,Integer status,String startTime,String endTime,Integer priority,String relevancy,Integer isrelevancy);

    Integer updateUrlIsGen(String shopName,Integer shopId);
    Integer updateUrlIsNotGen(String shopName,Integer shopId);
    OrderStatisVo OrderStatis(String shopName,Integer sid, String activeDate,Integer platform,Integer status,String startTime,String endTime,Integer priority, String relevancy,Integer isrelevancy);

    Boolean priorityShop(Integer shopId);

    Integer batchChangeRelevancy(List<String> ids, String relevancy);


    Integer updateUrlIsGenByRelevancy(String relevancy);


    @Select("SELECT \n" +
            "        CASE \n" +
            "            WHEN platform = 1 THEN '美团外卖'\n" +
            "            WHEN platform = 2 THEN '饿了么'\n" +
            "            WHEN platform = 3 THEN '京东秒送'\n" +
            "            ELSE '未知平台'\n" +
            "        END\n" +
            "      AS label, \n" +
            "    shop_name AS value \n" +
            "FROM shop where relevancy = #{relevancy}")
    List<SelectOptions> selectShopByNameList(String relevancy);


}
